<?php

require '../com.swiss.mooh.dao.impl/FileDaoImpl.php';
require '../com.swiss.mooh.service/FileContentServiceImpl.php';



$dispatcher = new FileDaoImpl();
$fileContentService = new FileContentServiceImpl($dispatcher);

$output_dir = "../../assets/images/uploads/files/";

if (isset($_POST["op"]) && $_POST["op"] == "delete" && isset($_POST['name'])) {
    $fileName = $_POST['name'];
    $filePath = $output_dir . $fileName;
    if (file_exists($filePath)) {
        unlink($filePath);
        $fileContentService->deleteFileContentByID($fileName);
    }
    echo "Deleted File " . $fileName . "<br>";
}
